<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">

	<head>

		<%@ include file="/WEB-INF/include/meta.jsp"%>
		<%@ include file="/WEB-INF/include/css.jsp"%>
	</head>

	<body>
		<%@ include file="/WEB-INF/include/header.jsp"%>
		<%@ include file="/WEB-INF/include/submenu.jsp"%>

		<div class="container-fluid umu-container has-umu-sidemenu">
			<div class="umu-breadcrumb">
				<div class="breadcrumb">学习过程详细信息</div>
			</div>
            <c:if test="${not empty param.attendanceMessage}">
              <div class="alert alert-danger alert-dismissible" role="alert">
              <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <strong>考情录入异常：</strong>&nbsp;&nbsp;${param.attendanceMessage}
            </div>
            </c:if>
            
            <c:if test="${not empty param.scoreMessage}">
              <div class="alert alert-danger alert-dismissible" role="alert">
              <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <strong>成绩导入异常：</strong>&nbsp;&nbsp;${param.scoreMessage}
            </div>
            </c:if>
            
			<div class="panel-default beast-panel beast-panel-layout">
				<div class="panel-body">
					<div class="col-xs-12 beast-panel-layout-right">
						<div class="ms-content-layout">
							<div class="form-horizontal ms-form form-personal-info">

								<div class="form-group ms-form-group">
									<label class="control-label col-xs-2" style="width: 12%;">编号：</label>
									<div class="col-xs-2">
										<p class="form-control-static">${project.code}</p>
									</div>
									<label class="control-label col-xs-2" style="width: 12%;">分类：</label>
									<div class="col-xs-2" style="width: 26%;">
										<p class="form-control-static">${project.firstCategory.name} - ${project.secondCategory.name}</p>
									</div>
								</div>

								<div class="form-group ms-form-group">
									<label class="control-label col-xs-2" style="width: 12%;">项目名称：</label>
									<div class="col-xs-2">
										<div class="form-control-static" style="cursor: pointer;  white-space: nowrap; text-overflow: ellipsis; overflow:hidden;" data-toggle="tooltip" title="${project.name}">${project.name}</div>
									</div>
									<label class="control-label col-xs-2" style="width: 12%;">总期数：</label>
									<div class="col-xs-2">
										<p class="form-control-static">${project.phaseCount}</p>
									</div>
								</div>

								<div class="form-group ms-form-group">
									<label class="control-label col-xs-2" style="width: 12%;">项目负责人：</label>
									<div class="col-xs-2">
										<c:set var="projectLead" value="${persist.idmUser(project.projectLead)}"></c:set>
										<p class="form-control-static" title="${projectLead.usercn}（${projectLead.orgDepart}）">${projectLead.usercn}</p>
									</div>
									<label class="control-label col-xs-2" style="width: 12%;">事业部：</label>
									<div class="col-xs-2">
										<p class="form-control-static">${project.department.name}</p>
									</div>
								</div>

								<div class="form-group ms-form-group">
									<label class="control-label col-xs-2" style="width: 12%;">开始时间：</label>
									<div class="col-xs-2">
										<p class="form-control-static">
											<fmt:formatDate value="${project.beginDate}" pattern="yyyy-MM-dd" />
										</p>
									</div>
									<label class="control-label col-xs-2" style="width: 12%;">结束时间：</label>
									<div class="col-xs-2">
										<p class="form-control-static">
											<fmt:formatDate value="${project.endDate}" pattern="yyyy-MM-dd" />
										</p>
									</div>
								</div>

							</div>

							<div class="umu-main">
								<ul class="nav nav-pills umu-tabs">
									<c:forEach items="${projectPhases}" var="projectPhase" varStatus="status">
										<li role="pull-left" class="${(projectPhase.phase) eq currentPhase ? 'active' : ''}">
											<a href="${ctx.host}/project-results/${project.id}?currentPhase=${projectPhase.phase}">项目${projectPhase.phase}期</a>
										</li>
									</c:forEach>
								</ul>
								<div class="form-group ms-form-group">
									<ul class="nav nav-pills umu-tabs">
										<li class="pull-left active" id="tab-trainee">
											<a href="#">课程</a>
										</li>
									</ul>
									<div class=" pull-right" style="margin-bottom: 23px;">
										<a href="${ctx.host}/project-results/${projectPhase.id }/trainee-survey-generate" class="btn btn-shadow-success btn-shadow umu-btn" data-target="#edit" data-toggle="modal">生成评估问卷</a>
									</div>
								</div>

								<table class="table table-hover umu-table tab-pane table-striped">
									<thead>
										<tr>
											<th>序号</th>
											<th>课程名称</th>
											<th>课程性质</th>
											<th>讲师姓名</th>
											<th>课程时长</th>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${projectPhaseCourses}" var="projectPhaseCourse" varStatus="cStatus">
											<tr>
												<td>${cStatus.index+1}</td>
												<td>${projectPhaseCourse.course.name}</td>
												<td>${projectPhaseCourse.course.property}</td>
												<td>${projectPhaseCourse.trainer.name}</td>
												<td>${projectPhaseCourse.course.hour}</td>
											</tr>
										</c:forEach>
									</tbody>
								</table>

								<ul class="nav nav-pills umu-tabs">
									<li class="pull-left active" id="tab-trainee">
										<a href="#">考勤记录</a>
									</li>
								</ul>
								<div id="tbl-trainee">
									<div class="pull-right" style="margin-bottom: 24px;">
										<c:if test="${currentPhase != size}">
											<a href="${ctx.host}/project-results/${projectPhase.id}/attendance-upload" class="btn btn-shadow-success btn-shadow umu-btn" data-target="#course-add" data-toggle="modal">考勤导入
											</a>&nbsp;&nbsp;
                      <a href="${ctx.host}/project-results/${projectPhase.id}/trainee-score-list" class="btn btn-shadow-success btn-shadow umu-btn" data-target="#inputResult" data-toggle="modal">输入/修改考勤
                      </a>&nbsp;&nbsp;
										</c:if>
										<c:if test="${currentPhase == size}">
											<a href="${ctx.host}/project-results/${project.id}/trainee-score-upload?projectPhaseId=${projectPhase.id}" class="btn btn-shadow-success btn-shadow umu-btn" data-target="#upload" data-toggle="modal">
											  <i class=""></i>&nbsp;&nbsp;成绩导入
										  </a>
                      <a href="${ctx.host}/project-results/${projectPhase.id}/trainee-score" class="btn btn-shadow-success btn-shadow umu-btn" data-target="#inputResult" data-toggle="modal">输入/修改成绩
                      </a>&nbsp;&nbsp;
										</c:if>
									</div>
									<c:if test="${currentPhase != size}">
									<table class="table table-hover umu-table tab-pane table-striped">
										<thead>
											<tr>
												<th>序号</th>
												<th>姓名</th>
												<th>邮箱</th>
												<th>记录日期</th>
												<th>成绩</th>
												<th>缺勤天数</th>
												<th>是否补考</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach items="${trainingResults}" var="trainingResult" varStatus="trainingResultStatus">
												<tr>
													<td>${trainingResultStatus.index + 1}</td>
													<td>${trainingResult.trainee.name}</td>
													<td>${trainingResult.trainee.email}</td>
													<td>
														<fmt:formatDate value="${trainingResult.submitDate}" pattern="yyyy-MM-dd" />
													</td>
													<td>${trainingResult.score}</td>
													<td>${trainingResult.absence}</td>
													<c:if test="${trainingResult.resit}">
														<td>是</td>
													</c:if>
													<c:if test="${!trainingResult.resit}">
														<td>否</td>
													</c:if>
												</tr>
											</c:forEach>
										</tbody>
										<tfoot>
											<tr>
												<td colspan="7" class="no-vertical-padding">
													<div class="pull-left">
														<jsp:include page="/WEB-INF/include/page.jsp">
															<jsp:param name="url" value="${ctx.host}/project-results/${project.id}" />
															<jsp:param name="queryString" value="${queryString}" />
														</jsp:include>
													</div>
												</td>
											</tr>
										</tfoot>
									</table>
									</c:if>
									
									<c:if test="${currentPhase == size}">
									<table class="table table-hover umu-table tab-pane table-striped">
										<thead>
											<tr>
												<th>序号</th>
												<th>学员姓名</th>
												<th>学员邮箱</th>
												<th>成绩</th>
												<th>缺勤天数</th>
												<th>是否补考</th>
												<th>是否结业</th>
												<th>备注</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach items="${trainingResults}" var="projectTrainee" varStatus="projectTraineeStatus">
												<tr>
													<td>${projectTraineeStatus.index + 1}</td>
													<td>${projectTrainee.trainee.name}</td>
													<td>${projectTrainee.trainee.email}</td>
													<td>${projectTrainee.score}</td>
													<td>${projectTrainee.absence}</td>
													<td>${projectTrainee.resit eq true ? '是' : '否'}</td>
													<td>${projectTrainee.complete eq true ? '是' : '否'}</td>
													<td>
														<div style="cursor: pointer; margin: 0 auto; text-align: center; width: 150px; white-space: nowrap; text-overflow: ellipsis; overflow:hidden;" data-toggle="tooltip" title="${projectTrainee.comment}">${projectTrainee.comment}</div>
													</td>
												</tr>
											</c:forEach>
										</tbody>
										<tfoot>
											<tr>
												<td colspan="8" class="no-vertical-padding">
													<div class="pull-left">
														<jsp:include page="/WEB-INF/include/page.jsp">
															<jsp:param name="url" value="${ctx.host}/project-results/${project.id}" />
															<jsp:param name="queryString" value="${queryString}" />
														</jsp:include>
													</div>
												</td>
											</tr>
										</tfoot>
									</table>
									</c:if>
								</div>

							</div>

							<div class="ms-operation-group pull-right">
								<a href="${ctx.host}/project-results" data-toggle="" data-target="#search" class="btn btn-shadow-success btn-shadow umu-btn">
									&nbsp;&nbsp;返回
								</a>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<%@ include file="/WEB-INF/include/footer.jsp"%>
		<%@ include file="/WEB-INF/include/script.jsp"%>
		<d:resource root="${ctx.resource}/build" type="script" src="js/page/project/project-result-list.js" />
		<script type="text/javascript">
			require(['page/project/project-result-list'], function(page) {
				page.init({
					subCategory: JSON.parse('${persist.subCategory}')
				});
			})
		</script>
	</body>

</html>